function [quants,RGB] = quantifySignalInCompartments(SQ,IndLists)

maskLD = false(size(SQ));
maskCell = false(size(SQ));
centroids = zeros(size(IndLists,1),2);
quants = zeros(size(IndLists,1),12);
labels = cell(1,size(IndLists,1));
for j = 1:size(IndLists,1)
    idxInLD = IndLists{j,1};
    idxNotInLD = IndLists{j,2};

    % id, signal in LD, signal not in LD, LD area, Cell-LD area ...
    % avg intensity in LD, avg intensity not in LD, avg_int_LD/avg_int_notInLD
    iiLD = sum(SQ(idxInLD));
    iiNotLD = sum(SQ(idxNotInLD));
    areaLD = numel(idxInLD);
    areaNotLD = numel(idxNotInLD);
    mdLD = median(SQ(idxInLD));
    mdNotLD = median(SQ(idxNotInLD));
    iqLD = iqr(SQ(idxInLD));
    iqNotLD = iqr(SQ(idxNotInLD));
    
    quants(j,:) = [j iiLD iiNotLD areaLD areaNotLD iiLD/areaLD iiNotLD/areaNotLD iiLD*areaNotLD/areaLD/iiNotLD mdLD mdNotLD iqLD iqNotLD];

    [ii,jj] = ind2sub(size(SQ),[idxInLD; idxNotInLD]);
    mii = round(mean(ii));
    mjj = round(mean(jj));

    centroids(j,:) = [mjj mii];

    maskLD(idxInLD) = true;
    maskCell(idxInLD) = true;
    maskCell(idxNotInLD) = true;

    labels{j} = sprintf('%d',j);
end

bdCells = bwmorph(maskCell,'remove');
bdLD = bwmorph(maskLD,'remove');

RGB = repmat(0.5*imadjust(SQ),[1 1 3]);
for k = 1:3
    C = RGB(:,:,k);
    C(bdCells) = 0;
    C(bdLD) = 0;
    RGB(:,:,k) = C;
end
C = RGB(:,:,1);
C(bdCells) = 1;
RGB(:,:,1) = C;
C = RGB(:,:,2);
C(bdLD) = 1;
RGB(:,:,2) = C;

RGB = insertText(RGB, centroids, labels, 'FontSize', 36, 'TextColor', 'white', 'BoxColor', 'black', 'BoxOpacity', 0);

end